home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kipc.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.9 KB  |  80 lines

  1. /* This file is part of the KDE libraries
  2.  
  3.    Copyright (C) 1999 Mattias Ettrich (ettrich@kde.org)
  4.    Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
  5.  
  6.    This library is free software; you can redistribute it and/or
  7.    modify it under the terms of the GNU Library General Public
  8.    License as published by the Free Software Foundation; either
  9.    version 2 of the License, or (at your option) any later version.
  10.  
  11.    This library is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.    Library General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU Library General Public License
  17.    along with this library; see the file COPYING.LIB.  If not, write to
  18.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.    Boston, MA 02110-1301, USA.
  20. */
  21.  
  22. #ifndef __KIPC_h_Included__
  23. #define __KIPC_h_Included__
  24.  
  25. #include <qwindowdefs.h>
  26. #include "kdelibs_export.h"
  27.  
  28. /**
  29.  * This class implements a very simple IPC mechanism for KDE. You can send
  30.  * a message of a predefined type to either a specific application, or to all
  31.  * KDE application on the current display. The message can carry one integer of
  32.  * data.
  33.  *
  34.  * KIPC is mainly used in KDE for sending "Change Messages", i.e. a message to
  35.  * all KDE apps that a certain setting (the font, for example) has changed.
  36.  * For anything more complex it is recommended to use DCOP -- the Desktop
  37.  * Communications Protocol.
  38.  *
  39.  * Messages with id code < 32 are called "System Messages". These are
  40.  * directly handled by KApplication. Examples are: PaletteChanged and
  41.  * StyleChanged. Messages with id code >= 32 are user messages. KApplication
  42.  * emits the signal kipcMessage(id,arg) for each user message it receives.
  43.  *
  44.  * KIPC is implemented using X11 ClientMessage events.
  45.  *
  46.  * @see KApplication::kipcMessage()
  47.  * @author Geert Jansen <jansen@kde.org>
  48.  */
  49. class KDECORE_EXPORT KIPC
  50. {
  51. public:
  52.     /**
  53.      * A identifier for messages. Messages below UserMessage are system
  54.      * messages, messages above can be defined by the user.
  55.      */
  56.     enum Message { PaletteChanged=0, FontChanged, StyleChanged,
  57.                    BackgroundChanged, SettingsChanged, IconChanged, ToolbarStyleChanged,
  58.                    ClipboardConfigChanged, /// @since 3.1
  59.                    BlockShortcuts, /// @since 3.5
  60.                    UserMessage=32 };
  61.  
  62.     /**
  63.      * Send a message to a specific application.
  64.      *
  65.      * @param msg The message to send.
  66.      * @param w The window id of a toplevel window of the target application.
  67.      * @param data An optional integer of data.
  68.      */
  69.     static void sendMessage(Message msg, WId w, int data=0);
  70.  
  71.     /**
  72.      * Send a message to all KDE application on the current display.
  73.      *
  74.      * @param msg The message to send.
  75.      * @param data An optional integer of data.
  76.      */
  77.     static void sendMessageAll(Message msg, int data=0);
  78. };
  79. #endif
  80.